package com.ass.controller;

import java.util.Iterator;
import java.util.List;

import com.ass.controller.elements.MyElement;

public class Searcher {
	List<MyElement> al;
	public Searcher(){
		
	}
	
	public Searcher(List<MyElement> al){
		this.al = al;
	}
	
	public MyElement find(String id){
		Iterator<MyElement> iterator = al.iterator();
		MyElement temp = null;
		while(iterator.hasNext()){
			temp = iterator.next();
			String tempID = temp.getID();
//			if((id.charAt(0) == '9') && (tempID.charAt(0) == '9')){
//				int length = id.length();
//				int tempLength = tempID.length();
//				if(((length-1) / 5) == ((tempLength - 1) / 5)){
//					return temp;
//				}
//			}
			if(tempID.equals(id)){
				return temp;
			}
		}
		return null;
	}
}
